#export surrealdb_version="surrealdb/surrealdb:nightly-dev"
export surrealdb_version="surrealdb/surrealdb:latest-dev"
# export SURREAL_CAPS_ALLOW_EXPERIMENTAL="graphql"
export hostname="localhost"
export surrealdb_port="8000"
export user="root"
export pass="root"
export container_name="surrealdb"
# docker rmi ${surrealdb_version}
docker rm ${container_name}
docker run --name ${container_name} \
  -p ${surrealdb_port}:${surrealdb_port} \
  -v ./mydata:/mydata \
  ${surrealdb_version} start \
  --allow-experimental graphql \
  --log debug \
  --user ${user} --pass ${pass} \
  surrealkv:/mydata/mydatabase.db \
 --allow-funcs "fn::hello,http::get" 
  # --allow-all
# --rm --pull always
# --deny-all --allow-net ${hostname}

# -e SURREAL_EXPERIMENTAL_GRAPHQL=true \
#  -e SURREAL_CAPS_ALLOW_EXPERIMENTAL=graphql \
# surrealkv://mydb
# surrealdb/surrealdb:nightly
# surrealdb/surrealdb:nightly-dev
#
#  rocksdb:/mydata/mydatabase.db \

# Allow SurrealDB to call any functions from the array and string families, generate and compare Argon2 hashes
# and make HTTP GET requests over HTTPS to the address of a specific API.
# surreal start --deny-all --allow-funcs "array, string, crypto::argon2, http::get" --allow-net api.example.com:443

# Avoid doing this:
# Allow SurrealDB to make outgoing HTTP GET and POST request to any address except to some known private CIDR blocks.
# surreal start --deny-all --allow-funcs "http::get, http::post" --allow-net --deny-net "10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16"
